/**
 * 
 */
package mt.validator;

import java.util.Date;

import com.jfinal.core.Controller;

import base.model.SessionModel;
import mt.Const;

/**
 * @author suanp
 *
 */
public class OrderMerchantQueryValidator extends AbsCommonValidator {

	@Override
	protected void validate(Controller c) {

		final SessionModel session = (SessionModel) c.getSessionAttr("SessionModel");

		final Date startDate = c.getParaToDate("startDate", null);
		final Date endDate = c.getParaToDate("endDate", null);

		if (session == null) {
			addError(Const.ERRMSG_KEY, "操作失败，店铺信息错误，请重新登录再试!");
		}
		if (startDate != null && endDate != null && endDate.before(startDate)) {
			addError(Const.ERRMSG_KEY, "操作失败，时间范围参数不正确!");
		}
	}

}
